

import java.util.Scanner;
/*
*/
public class MaxDivision {
    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);

        while (sc.hasNext()) {
            int a = sc.nextInt();
            int b = sc.nextInt();
            System.out.println(getMD(a, b));
        }

    }
    public static int getMD(int a, int b) {
        // int accum = a * b;
        int remainder = a % b;
        while (remainder != 0) {
            a = b;
            b = remainder;
            remainder = a % b;

        }
        return b;
        // return accum/b;
    }
}
